/***********************************************************************
** Copyright (C) 2011 Anthony Naddeo <anthony.naddeo@gmail.com>
**
** This file is part of qtweather-qml
**
** qtweather-qml is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**
** qtweather-qml is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this package; If not, see <http://www.gnu.org/licenses/>.
**
***********************************************************************/

import QtQuick 1.1
import com.meego 1.0


PageStackWindow {
	id: appWindow
	initialPage: mainPage
	showStatusBar: mainPage.width > mainPage.height ? false : true
	Component.onCompleted: {theme.inverted = true}


	Timer{id: timer
		interval: 500
		running: true
		onTriggered: {
			if(!Utilities.defaultHome() || Utilities.home(Utilities.defaultHome()) === "null" ){
				mainPage.settingsLoader.item.open()
			}else{
				mainPage.zipcode = Utilities.home(Utilities.defaultHome())
			}
		}
	}

	MainPage{id: mainPage}



	ToolBarLayout {
		id: commonTools
		visible: true

		ToolIcon { id: menu; platformIconId: "toolbar-view-menu";
			anchors.right: parent===undefined ? undefined : parent.right
			onClicked: mainPage.settingsLoader.item.status === DialogStatus.Closed ? mainPage.settingsLoader.item.open() : mainPage.settingsLoader.item.close()

		}
		BusyIndicator{
			anchors.left: parent.left
			anchors.leftMargin: 10
			anchors.verticalCenter: parent.verticalCenter
			running: mainPage.busy
			visible: running
		}
		Label{
			text: mainPage.title
			anchors.left: parent.left
			anchors.verticalCenter: parent.verticalCenter
			font.pixelSize: 35
			visible: !mainPage.busy
			font.family: "URW Gothic L"
		}
	}

}
